<!DOCTYPE html>
<html>
  <head>
    <title>hprose websocket client test</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="hprose.js"></script>
  </head>
  <body>
    <script>
    var client = hprose.Client.create('ws://127.0.0.1:8080', ['hello']);
    client.ready(function(stub) {
        stub.hello.idempotent = true;
        stub.hello('中国🇨🇳')
        .then(function(result) {
            console.info(result);
        },function(e) {
            console.error(e);
        });
        stub.hello(hprose.binary('Hello'), function(result) {
            console.info(result);
        }, function(e) {
            console.error(e);
        }, { binary: true });
        client.batch.begin();
        stub.hello('World 1')
        .then(function(result) {
            console.info(result);
        });
        stub.hello('World 2')
        .then(function(result) {
            console.info(result);
        });
        stub.hello('World 3')
        .then(function(result) {
            console.info(result);
        });
        client.batch.end();
    },
    function(e) {
        console.error(e);
    });
    </script>
  </body>
</html>
